/*
 * Contract.java
 *
 * Created on May 3, 2005, 10:57 AM
 */

/** This class specifies the contract between parent and child cyberorgs
 *  it indicates the amount of resources child cyberorg receives, 
 *  and the price of those resources child cyberorg has to pay
 */

package aa.core;

import java.io.Serializable;

/**
 * This class represents a contract
 * 
 * @author  xinghuizhao
 */
public class Contract implements Serializable{
    
    long m_lTicks; //how much resources are given to the child cyberorg in one scheduler cycle
    
    long m_lTicksRate; //the rate of resources that the child cyberorg would get with respect to the root cyberorg
    
    long m_lPrice; //price of those resources
    
    /** Creates a new instance of Contract 
     *
     *This is the contract for the root cyberorg, which gets all resources in system
     
     */
    
    public Contract() {
        
        m_lTicks = 90000000; //initially the root cyberorg get 10 sec 
        
        m_lTicksRate = 900000; // with respect to 1000 (resources in root cyberorg)
        
        m_lPrice = 0; //get all resources with zero price
        
    }
    
    /** Creates new instance of Contract using parameters*/
    
    public Contract(long p_lTicks,long p_lTicksRate,long p_lPrice){
        
        m_lTicks = p_lTicks;
        
        m_lTicksRate = p_lTicksRate;
        
        m_lPrice = p_lPrice;
        
    }
    
    /**
     * 
     * @return Ticks
     */
    public long getTicks(){
        return m_lTicks;
    }
    
    /**
     * 
     * @return TicksRate
     */
    public long getTicksRate(){
        return m_lTicksRate;
    }
    
    /**
     * 
     * @return Price
     */
    public long getPrice(){
        return m_lPrice;
    }
    
    /**
     * Returns to a string representing the contract
     */
    public String toString(){
        String thisCon = new String();
        thisCon += m_lTicks + " " + m_lTicksRate + " " + m_lPrice;
        return thisCon;
    }
    
}
